package com.neusoft.elmboot.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.neusoft.elmboot.po.User;
import com.neusoft.elmboot.service.UserService;

@RestController
@RequestMapping("/UserController")
public class UserController {
	
	 @Autowired
	 private UserService userService;

	 @RequestMapping("/getUserByIdByPass")
	 public User getUserByIdByPass(User user) throws Exception{
	 return userService.getUserByIdByPass(user);
	 }
	 
	 @RequestMapping("/getUserById")
	 public int getUserById(User user) throws Exception{
	 return userService.getUserById(user.getUserId());
	 }
	 
	 @RequestMapping("/saveUser")
	 public int saveUser(User user) throws Exception{
	 return userService.saveUser(user);
	 }

	@RequestMapping("/UpdateCredit")
	public int UpdateCredit(String userId, Integer credit) throws Exception{
		return userService.UpdateCredit(userId,credit);
	}

	@RequestMapping("/updateUserInfo")
	public int updateUserInfo(User user) throws Exception{
		return userService.updateUserInfo(user);
	}
	
	@RequestMapping("/updateUserPass")
	public int updateUserPass(User user) throws Exception{
		return userService.updateUserPass(user);
	}
	
	@RequestMapping("/getUserRoleById")
	public int getUserRoleById(User user) throws Exception{
		return userService.getUserRoleById(user);
	}

	@RequestMapping("/getUserInfoById")
	public String getUserInfoById(User user)throws Exception{
		return userService.getUserInfoById(user.getUserId());
	}
}
